﻿using System;
using System.Linq;
using System.IO;
using System.IO.IsolatedStorage;
using System.Collections.Generic;
using Microsoft.LightSwitch;
using Microsoft.LightSwitch.Framework.Client;
using Microsoft.LightSwitch.Presentation;
using Microsoft.LightSwitch.Presentation.Extensions;
namespace LightSwitchApplication
{
    public partial class SearchSalesOrders
    {

        partial void SearchSalesOrders_InitializeDataWorkspace(List<IDataService> saveChangesTo)
        {
            var item = this.DataWorkspace.SalesDepData.aspnet_Profiles.Where(c => c.aspnet_User.UserName == this.Application.User.Name).FirstOrDefault();
            if (item != null)
                this.SalesOrderaspnet_Profile_UserId = item.aspnet_User.UserId;
        }

        partial void Cancel_Execute()
        {
            this.Close(false);
        }

        partial void Search_Execute()
        {
            this.FilteredSalesOrders.Load();
        }

        partial void ClearFilter_Execute()
        {
            if (!this.FindControl("SelectedShop").IsReadOnly)
            {
                this.SelectedShop = null;
            }

            this.SelectedId = null;
            this.SelectedDateFrom = null;
            this.SelectedDateTo = null;
            this.SelectedInvoiceNumber = null;
        }

    }
}
